Orient a small Unicode editor Version 2.4

  (by Jacob Saportas 20/01/2003)

 

Technical notes.

 

1) History of the project: Yet another Small Editor!

 

The project of a small Unicode editor was in my mind at the beginning of 2002. I needed a Unicode "Swiss Army Knife", I mean an editor in which I could put whatever function I need, to help me in my foreign languages study.

 

In September 2002, I installed two free compilers on my Win2K laptop: Gnu MinGW and Jacob Navia's lcc-win32. I have chosen the last one for a practical reason, I do not speak well C++ !

 

Good choice! Navia's compiler is a very good tool, and is free.

http://www.cs.virginia.edu/~lcc-win32/

 

ORIENT is entirely written in C, and is free.

2) Unicode.

 

All data storage in ORIENT is Unicode compatible; that means a character is no longer equivalent to a byte (8 bits) but to a word (a least 16 bits).

 

Unicode can render all languages on earth.

 

But the software is dedicated (as future enhancements) to languages of Orient (Middle and Far East).

 

ORIENT is working only under WIN2K and XP, since those OS are internally handling Unicode. It won’t work under WIN95 or Win98.

 

3) Unicode files

 

Files in ORIENT a pure Unicode files (no proprietary information added).

 

In ORIENT the "Save function" inserts a Unicode Utf-16 (little endian) file signature: (WORD   wByteOrderMark = 0xFEFF)  as a header to the file.

 

The load and save generic functions use UTF-16 little endian LE files.

 

That is to say the word flow is the same as in memory (Intel convention: most significant byte first and less significant byte at the end (little endian) e.g. Hebrew aleph is hex d005.

 

4) The read function

 

In version 2.3, the read logic has been completely re-written. It now checks Unicode formats.

 

It can now load:

 

-          UTF-16 big endian BE files, (thanks to Ch. Petzold for the swap logic),

-          Unix UTF-8 (ISO 10646-1) files,

-          pure ANSI files,

(more in the future).

 

5) File filters

 

In version 2.3, they support (*.uni & *.txt) in input and (*.uni) in output.

 

6) Bidirectional algorithm (BIDI).

 

2 buttons for RTL (Right to Left) and LTR (Left to Right), are located on the Tool Bar.

 

The BIDI is implemented at the paragraph level using the rich-edit 2.0 facility (PARAFORMAT2) like in MS-Word2002.

 

The user can select a language to start. The program will remember the last bidi used and will associate the language to the correspondent button.

 

If you use first AR (Arabic) then the RTL bidi button will:

- switch the paragraph layout to RTL,

- switch the reading order to RTL (RTL Arabic complex script rules), and finally call the Arabic language (AR) keyboard layout,

- keep the memory of the last bidi (AR) in the registry.

 

The user can, naturally, mix languages and add English words in an Arabic text for example,

the reading order being preserved (RTL in this case) :

<left> <ARword2> <ENword> <ARword1> <right>.

 

The find and replace logic is bidi aware.

 

7) Arabic ligatures and Hebrew diacritics.

 

The program uses the "Rich Edit" Library.

 

The rich edit control used by the program is a client of Uniscribe shaping engine (usp10.dll) that comes with Win2K and Windows XP.

 

That gives to Small Unicode Editor, powerful shaping capabilities:

- Arabic ligatures,   

- Nikud in Hebrew,

- Ta’amei hamikra in Hebrew, you must use an appropriate font: SIL EZRA, SBL, Guttman fonts from the Office XP proofing kit, Code2000.

 

8) Chinese, Japanese and other Far East languages.

 

Uniscribe gives standard shaping capabilities for Chinese and Japanese.

The user can use IME to enter kanji and kana characters in Japanese, traditional Chinese characters and Korean characters.

For more details on the features and options of each input method editor (Chinese, Japanese or Korean), look at Microsoft's own help files and on the appropriate Microsoft link:

Simplified Chinese IME,
Traditional Chinese IME,
Japanese IME,
Korean IME.

 

9) Conversion and "mirroring" functions for Middle East languages.

 

In this version 2.3, three conversion functions are coded for Arabic and Hebrew old 8bit code page; I often needed them to help text migrations from Win98 localized applications.

 

They work on the current selection.

 

- "mirroring": a yellow button is provided to reverse characters in a string (abcd -> dcba),

- function "CP1255->Unicode" is doing code page conversion and "mirroring", for Hebrew,

- function "CP1256->Unicode" is doing code page conversion and "mirroring", for Arabic,

 

The 2 last functions are doing "mirroring" before code page translation.

 

If only a code page translation is needed: use the "CP125X->Unicode" and next the "mirroring" function. It can be useful for working with applications under localized Hebrew and Arabic version of Windows (in this case mirroring is done at the OS level).

 

The code page translation is made on a character by character basis, remember tough a "character" is not an 8 bit "char" in Unicode.

 

10) New in Version 2.4

Printing function has been re-worked completely. I know what I am talking about when I say that Windows programming is much more difficult to master than biblical Hebrew, classical Arabic or traditional Chinese.

Now (March 2004), Orient can print using the True Type and Open type fonts. It is a big step for this small piece of code which is still less than 150 KB.

To right align on the printer a Hebrew or Arabic text, just “select all” (F2 key) and push the RTL yellow button.

Please be kind to report problem, if any.

 

יעקוב שפורטא

(Jacques Laporte)

http://jacob.saportas.free.fr/index.html